#include "guitools.h"
#include <math.h>

GUITools::GUITools(QObject *parent) :
  QObject(parent)
{
}

double GUITools::makeCardSize(uint q, double w, double h, qreal s, double r){
	double l = 0;
	uint n, m;
	do{
		++l;
		n = (int)((w + s)/(l + s));
		if(n == 0)
			continue;
		m = ((int)(q / n) + ((q % n) > 0? 1 : 0));		
	}while(l * r * m + s * (m + 1) <= h);
	return --l;
}
